package sctu.edu.java.year2016.team01.zhuming.day20160613.Practice;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Created by Administrator on 2016/6/13.
 */
public class Address {
    public static void main(String[] args) {
        InetAddress ip;
        try {
            ip = InetAddress.getLocalHost();
            String localname=ip.getHostName();
            String localip=ip.getHostAddress();

            System.out.println("本地主机名是："+localname);
            System.out.println("本地Ip地址是："+localip);
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }


    }

}
